window.onload = function () {
    var name = $("#username").val();
    $.ajax({
        url: "show.action",
        type: "post",
        async: true,
        dataType: "json",
        contentType: "application/x-www-form-urlencoded;charset=utf-8",
        data: {
            "name": name
        },
        success: function (data) {
            console.log(data)
            $("#b1").html(data.show.loanproductid);
            $("#b2").html(data.show.sign);
            /* $("#b3").html(data.show.);
             $("#b4").html(data.show.);
             $("#b5").html(data.show.);
             $("#b6").html(data.show.);
             $("#b7").html(data.show.);*/
        }, error: function () {
            alert("贷款信息，请求错误！")
        }
    })
}

function a1() {

    var yinhangkahao = $("#in1").val();
    var huankuanfangshi = $("#select1").val();

    setCookie('kahao', yinhangkahao, 7);
    setCookie('fangshi', huankuanfangshi, 7);
   var pattern=new RegExp("([\\d]{4})([\\d]{4})([\\d]{4})([\\d]{4})([\\d]{0,})")
    if (!(pattern.test($("#in1").val()))) {
        alert("请输入正确的银行卡号！");
        return;
    }

    window.location.href = "contract1.jsp";

}

//设置cookie
var setCookie = function (name, value, day) {
    //当设置的时间等于0时，不设置expires属性，cookie在浏览器关闭后删除
    var expires = day * 24 * 60 * 60 * 1000;
    var exp = new Date();
    exp.setTime(exp.getTime() + expires);
    document.cookie = name + "=" + value + ";expires=" + exp.toUTCString();
};
//删除cookie
var delCookie = function (name) {
    setCookie(name, ' ', -1);
};